home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / term / scripts / terminusconfig.scp < prev   
Encoding:
Text File  |  1993-07-05  |  17.4 KB  |  503 lines

  1. /* $VER: Terminus 2.0 - TerminusConfig.scp (03.07.93) */
  2.  
  3. /*
  4. ** Copyright (C) 1992-3, John P. Radigan, All Rights Reserved, Worldwide.
  5. **
  6. **    This script is only executed if the Terminus session was unable
  7. ** to find a defaults, phonebook and startup script.  It will help you
  8. ** configure the serial device and modem for use with the session that
  9. ** called it.
  10. **
  11. **    If you find any aspects of this script to be lacking due to a
  12. ** feature that your modem has that has been overlooked, or you feel
  13. ** that it's utility can be enhanced in some way please feel free to
  14. ** document any changes you've made to this script and send it to the
  15. ** support BBS or P.O. Box so that the changes can be added to the next
  16. ** release of Terminus.
  17. **
  18. */
  19.  
  20.    devname$ = "serial.device"
  21.    devunit = 0
  22.  
  23. restart:
  24.    goto main
  25.  
  26.    print local "\n   ";
  27.    gosub get_ans
  28.    
  29.    if ans$ == "Y"
  30.    endif
  31.  
  32.    _cmd$ = ""
  33.    input local "\n   []: ", ans$
  34.    if len(ans$)
  35.       _cmd$ = ans$
  36.    endif
  37.  
  38. send_cmd:
  39.    send modem_cmd$
  40.    ontimeout goto not_ok
  41.    wait 5, ok_res$
  42.    ontimeout
  43.    return
  44.  
  45. not_ok:
  46.    print local "Modem did not respond or an error occured, retry";
  47.    gosub get_ans
  48.  
  49.    if ans$ == "Y"
  50.       pop
  51.       goto restart
  52.    endif
  53.    end
  54.  
  55. cont:
  56.    ask local "\nPress any key to continue ", ans$
  57.    print local
  58.    return
  59.  
  60. get_ans:
  61.    ask local " [Y]/n? ", ans$
  62.    print local
  63.    ans$ = trim$(upper$(ans$))
  64.    if ans$ != "N"
  65.       ans$ = "Y"
  66.    endif
  67.    return
  68.  
  69. main:
  70.    cls
  71.    print local "\n       *******                           *"
  72.    print local "          *"
  73.    print local "          *    ****   * ***   **** ***   *  ****   *   *   ****"
  74.    print local "          *   *    *  **   *  *   *   *  *  *   *  *   *  *"
  75.    print local "          *   ******  *       *   *   *  *  *   *  *   *   ****"
  76.    print local "          *   *       *       *   *   *  *  *   *  *   *       *"
  77.    print local "          *    ****   *       *   *   *  *  *   *   ****   ****"
  78.  
  79.    print local "\n   Welcome to the Terminus modem configuration script.  The purpose of this"
  80.    print local "script is to help you configure Terminus and your modem with a minimum of"
  81.    print local "fuss and to insure that they will work together properly when dialing and"
  82.    print local "transfering data."
  83.  
  84.    print local "\n   Due to the many differences between today's high speed modems as well as"
  85.    print local "with some of the less sophisticated models of a few years ago, this script"
  86.    print local "tries to be as generic as possible so that most any modem can be configured."
  87.    print local "Because of this, any features unique to your modem will be left in a factory"
  88.    print local "default state, you will have to adjust these settings after the script"
  89.    print local "completes.\n\n   Proceed with modem configuration";
  90.    gosub get_ans
  91.  
  92.    if ans$ == "N"
  93.       end
  94.    endif
  95.  
  96. get_port:
  97.    cls
  98.    print local "\n\n   The first thing to do is to define the serial device driver and the"
  99.    print local "unit that Terminus will use to communicate with your modem.  The current"
  100.    print local "driver and unit are:"
  101.  
  102. show_port:
  103.    print local "\n   Device: \""; devname$; "\""
  104.    print local "     Unit: "; devunit
  105.    print local "\n   Is this the correct device and unit";
  106.    gosub get_ans
  107.    
  108.    if ans$ == "N"
  109.       print local "\n   Please remember that AmigaDOS is case sensitive when it comes to"
  110.       print local "device names, please enter the name of the driver as it exists on disk."
  111.       gosub cont
  112.       getstring "Enter the device driver you want to use", devname$
  113.       getint "Enter the unit number for this device", devunit, 0, 9999
  114.       goto show_port
  115.    endif
  116.    
  117.    serdev$ = devname$ + " " + str$(devunit)
  118.  
  119. get_baud:
  120.    cls
  121.    print local "\n\n   Now select the default baud rate to use:"
  122.    print local "\n\n      1. 300"
  123.    print local "      2. 600"
  124.    print local "      3. 1200"
  125.    print local "      4. 2400"
  126.    print local "      5. 4800"
  127.    print local "      6. 9600"
  128.    print local "      7. 19200"
  129.    print local "      8. 31250 (MIDI)"
  130.    print local "      9. 38400"
  131.    print local "     10. 57600"
  132.    print local "     11. 115200"
  133.    input local "\n     Your choice: ", ans
  134.    
  135.    if ans < 1 AND ans > 11
  136.       print local "Invalid choice, reenter."
  137.       wait 2
  138.       goto get_baud
  139.    endif
  140.  
  141.    if ans == 1
  142.       baud = 300
  143.       goto set_modem
  144.    endif
  145.  
  146.    if ans == 2
  147.       baud = 600
  148.       goto set_modem
  149.    endif
  150.  
  151.    if ans == 3
  152.       baud = 1200
  153.       goto set_modem
  154.    endif
  155.  
  156.    if ans == 4
  157.       baud = 2400
  158.       goto set_modem
  159.    endif
  160.  
  161.    if ans == 5
  162.       baud = 4800
  163.       goto set_modem
  164.    endif
  165.  
  166.    if ans == 6
  167.       baud = 9600
  168.       goto set_modem
  169.    endif
  170.  
  171.    if ans == 7
  172.       baud = 19200
  173.       goto set_modem
  174.    endif
  175.  
  176.    if ans == 8
  177.       baud = 31250
  178.       goto set_modem
  179.    endif
  180.  
  181.    if ans == 9
  182.       baud = 38400
  183.       goto set_modem
  184.    endif
  185.  
  186.    if ans == 10
  187.       baud = 57600
  188.       goto set_modem
  189.    endif
  190.  
  191.    if ans == 11
  192.       baud = 115200
  193.    endif
  194.  
  195. set_modem:
  196.    cls
  197.    print local "\n\nDoes your modem have dip switches";
  198.    gosub get_ans
  199.    if ans$ == "Y"
  200.       print local "\n\n   Although the types of modems and their dip switch settings often vary"
  201.       print local "considerably between each model, the following are typical options that"
  202.       print local "are usually assigned to modem dip switches.  Please consult your modem"
  203.       print local "reference manual to insure that correct switches are changed as needed."
  204.       print local "\n      - DSR forced on."
  205.       print local "      - DTR, CTS, RTS and DCD should function normally, not forced on."
  206.       print local "      - Verbose (word) modem responses instead of terse (digit)."
  207.       print local "      - Command mode, echo  and responses enabled, not suppressed."
  208.       print local "      - Escape code (+++) should drop to command mode."
  209.       print local "      - Hayes compatible AT command set allowed."
  210.       print local "      - Load NVRAM settings when powered on."
  211.       print local "      - Automatic answer mode disabled."
  212.       print local "\n   Again, these are typical dip switch options, your modem may differ in"
  213.       print local "the ones it supports."
  214.       gosub cont
  215.  
  216.       if ans$ == "N"
  217.          end
  218.       endif
  219.       cls
  220.    endif
  221.  
  222.    print local "\n\n   You're now ready to configure your modem, please have the reference"
  223.    print local "manual (or hardcard) handy so that you can consult it when answering the"
  224.    print local "following questions.  Items in [] brackets are the default values,"
  225.    print local "press <RETURN> to use that value."
  226.  
  227.    print local "\nDoes your modem have nonvolatile memory (NVRAM)";
  228.    gosub get_ans
  229.    nvram$ = ans$
  230.  
  231.    print local "\nDoes your modem support error correction";
  232.    gosub get_ans
  233.    mnp4$ = ans$
  234.  
  235.    print local "\nDoes your modem support data compression";
  236.    gosub get_ans
  237.    mnp5$ = ans$
  238.  
  239.    at_cmd$ = "AT"
  240.    getstring "What is the modem attention code", at_cmd$
  241.  
  242.    reset_cmd$ = "Z"
  243.    getstring "Modem reset command", reset_cmd$
  244.  
  245.    modempostfix$ = "^M"
  246.    getstring "Postfix character to send a modem command", modempostfix$
  247.  
  248.    ok_res$ = "OK"
  249.    getstring "OK result code", ok_res$
  250.  
  251.    responseok$ = ok_res$
  252.  
  253.    print local "\nAttempting to reset modem.\n"
  254.    modem_cmd$ = at_cmd$ + reset_cmd$ + modempostfix$
  255.    gosub send_cmd
  256.  
  257.    print local "\n   Does your modem have a factory default command";
  258.    gosub get_ans
  259.  
  260.    if ans$ == "Y"
  261.       facdef_cmd$ = "&F"
  262.       getstring "Factory default command", facdef_cmd$
  263.       print local "\nAttempting to reset modem.\n"
  264.       modem_cmd$ = at_cmd$ + facdef_cmd$ + modempostfix$
  265.       gosub send_cmd
  266.    endif
  267.  
  268.    if nvram$ == "Y"
  269.       save_cmd$ = "&W"
  270.       getstring "Write to NVRAM command", save_cmd$
  271.       print local "\nAttempting to save to ram.\n"
  272.       modem_cmd$ = at_cmd$ + save_cmd$ + modempostfix$
  273.       gosub send_cmd
  274.    endif
  275.  
  276.    echo_cmd$ = "E1"
  277.    getstring "What turns on command echo", echo_cmd$
  278.  
  279.    result_cmd$ = "Q0"
  280.    getstring "Command that returns result codes", result_cmd$
  281.  
  282.    verb_cmd$ = "V1"
  283.    getstring "Command that selects verbal result codes:", verb_cmd$
  284.  
  285.    x_cmd$ = "X4"
  286.    getstring "Command to return extended result codes", x_cmd$
  287.    
  288.    blind_cmd$ = ""
  289.    print local "\nDoes your modem have a wait-for-dialtone dial mode";
  290.    gosub get_ans
  291.  
  292.    if ans$ == "Y"
  293.       getstring "Command to allow use wait-for-dialtone dialing:", blind_cmd$
  294.    endif
  295.  
  296.    dcd_cmd$ = ""
  297.    print local "\nDoes your modem have a DCD control command";
  298.    gosub get_ans
  299.  
  300.    if ans$ == "Y"
  301.       dcd_cmd$ = "&C1"
  302.       getstring "Command to allow DCD to function normally", dcd_cmd$
  303.    endif
  304.  
  305.    dtr_cmd$ = ""
  306.    dtrhangup = FALSE
  307.    print local "\n   Does your modem support dropping DTR to hangup";
  308.    gosub get_ans
  309.  
  310.    if ans$ == "Y"
  311.       dtr_cmd$ = "&D2"
  312.       getstring "Command to allow DTR to function normally:", dtr_cmd$
  313.       dtrhangup = TRUE
  314.       modemhangupcmd$ = ""
  315.    else
  316.       hang_cmd$ = "H"
  317.       getstring "On hook command (hang up modem)", hang_cmd$
  318.  
  319.       plus_cmd$ = "+++"
  320.       getstring "Escape sequence to return to command state:", plus_cmd$
  321.       modemhangupcmd$ = "~~~" + plus_cmd$ + "~~~" + at_cmd$ + hang_cmd$ + modempostfix$
  322.    endif
  323.  
  324.    print local "\n   If there are any remaining commands that need to be sent to the"
  325.    print local "modem, please enter them now."
  326.    gosub cont
  327.  
  328.    extra_cmd$ = ""
  329.    getstring "Please enter miscellaneous commands", extra_cmd$
  330.  
  331.    if nvram$ == "Y"
  332.       print local "\nConfiguring basic modem settings.\n"
  333.       modeminitcmd$ = at_cmd$ + reset_cmd$ + modempostfix$
  334.       modem_cmd$ = modeminitcmd$
  335.       gosub send_cmd
  336.       modem_cmd$ = at_cmd$ + echo_cmd$ + result_cmd$ + verb_cmd$ + x_cmd$ + dcd_cmd$ + dtr_cmd$ + extra_cmd$ + save_cmd$ + modempostfix$
  337.       gosub send_cmd
  338.    else
  339.       modeminitcmd$ = at_cmd$ + reset_cmd$ + modempostfix$ + "~~~" + at_cmd$ + echo_cmd$ + result_cmd$ + verb_cmd$ + x_cmd$ + dcd_cmd$ + dtr_cmd$ + modempostfix$
  340.    endif
  341.  
  342.    dial_cmd$ = "DT"
  343.    getstring "What is the dial command:", dial_cmd$
  344.  
  345.    modemprefix1$ = at_cmd$
  346.    modemprefix2$ = at_cmd$
  347.    modemprefix3$ = at_cmd$
  348.    modemprefix4$ = at_cmd$
  349.  
  350.    if mnp4$ == "Y"
  351.       mnp4on_cmd$ = ""
  352.       getstring "What command enables error correction", mnp4on_cmd$
  353.       modemprefix1$ = modemprefix1$ + mnp4on_cmd$
  354.       modemprefix2$ = modemprefix2$ + mnp4on_cmd$
  355.       mnp4off_cmd$ = ""
  356.       getstring "What command disables error correction:", mnp4off_cmd$
  357.       modemprefix3$ = modemprefix3$ + mnp4off_cmd$
  358.    endif
  359.  
  360.    if mnp5$ == "Y"
  361.       mnp5on_cmd$ = ""
  362.       getstring "What command enables data compression", mnp5on_cmd$
  363.       modemprefix1$ = modemprefix1$ + mnp5on_cmd$
  364.       mnp5off_cmd$ = ""
  365.       getstring "What command disables data compression:", mnp5off_cmd$
  366.       modemprefix2$ = modemprefix2$ + mnp5off_cmd$
  367.       modemprefix3$ = modemprefix3$ + mnp5off_cmd$
  368.    endif
  369.  
  370.    modemprefix1$ = modemprefix1$ + dial_cmd$
  371.    modemprefix2$ = modemprefix2$ + dial_cmd$
  372.    modemprefix3$ = modemprefix3$ + dial_cmd$
  373.    modemprefix4$ = modemprefix4$ + dial_cmd$
  374.  
  375.    if mnp4$ == "Y" or mnp5$ == "Y"
  376.       cls
  377.       print local "\n\n   The dialing prefixes have now been configured as follows"
  378.       print local "\n      Prefix1 - Enables error correction and data compression if"
  379.       print local "\n      Prefix2 - Enables error correction, disables data compression."
  380.       print local "\n      Prefix3 - Disables error correction and data compression."
  381.       print local "\n      Prefix4 - Same as Prefix1."
  382.       gosub cont
  383.    endif
  384.  
  385.    cls
  386.    print local "\n   The next phase of modem configuration requires the entry of the various"
  387.    print local "response codes that the modem can return during dialing.  If your modem does"
  388.    print local "not support one or more of the following codes you can leave it as is or you"
  389.    print local "can erase the default string that is supplied by Terminus."
  390.  
  391.    print local "\n   There is one response code, \"RING\" that is normally left blank by"
  392.    print local "default.  If your modem is used on a phone line that is often receiving"
  393.    print local "incoming calls you may want to put the appropriate response in order to"
  394.    print local "allow the dialer to stop dialing when it recognizes an incoming call."
  395.  
  396.    print local "\n   One other thing to keep in mind concering the \"RING\" response is that"
  397.    print local "some modems return a \"RINGING\" response prior to the remote end going off"
  398.    print local "hook.  Since \"RING\" is a subset of \"RINGING\", a false detection would"
  399.    print local "occur by Terminus.  This is why the string is left blank by default.  If you"
  400.    print local "do enter something, please be sure that it will not cause a detection"
  401.    print local "collision by using a string such as \"RING^M\" or whatever the modem returns"
  402.    print local "for that response.\n"
  403.    gosub cont
  404.  
  405.    getstring "BUSY result code", responsebusy$
  406.    getstring "CONNECT result code", responseconnect$
  407.    getstring "ERROR result code", responseerror$
  408.    getstring "NO CARRIER result code", responsenocarrier$
  409.    getstring "NO DIALTONE result code", responsenodialtone$
  410.    getstring "RING result code", responsering$
  411.    getstring "VOICE result code", responsevoice$
  412.  
  413.    if mnp4$ == "Y" or mnp5$ == "Y"
  414.       cls
  415.       print local "\n\n   Your modem requires additional configuration for hardware flow control,"
  416.       print local "also called \"CTS/RTS\" handshaking.  This is needed since an error"
  417.       print local "correcting modem needs to operate at a fixed baud rate that is higher"
  418.       print local "than it's maximum connect rate in order for error correction to work"
  419.       print local "as efficiently as possible."
  420.       print local "\n   The following questions do not have default settings as each modem"
  421.       print local "will most likely use a different command for each function that the"
  422.       print local "question asks you.  If your modem does not support that particular"
  423.       print local "command, just press <ENTER> and continue on to the next command.  If"
  424.       print local "several commands are needed to accomplish the function that the question"
  425.       print local "asks enter them consecutively prior to pressing <RETURN>."
  426.       print local "\n   If at the end of the questions you feel that certain commands have"
  427.       print local "not been entered, you will have a chance to enter these in one string"
  428.       print local "to send to the modem for configuring."
  429.       print local "\n   The first command required is the one that will force the modem to"
  430.       print local "fix the baud rate between the modem and computer, called the \"DTE rate\","
  431.       print local "some modems call this \"Baud Adjust\" or something similar."
  432.       gosub cont
  433.  
  434.       fixed_cmd$ = ""
  435.       getstring "Please enter the command that locks the DTE baud rate:", fixed_cmd$
  436.  
  437.       print local "\n\n   The next command to enter is the one that permanently sets the DSR"
  438.       print local "signal line.  This is required so that the Amiga serial.device can use"
  439.       print local "hardware flow control."
  440.       gosub cont
  441.  
  442.       dsr_cmd$ = ""
  443.       getstring "Please enter the command that forces DSR on", dsr_cmd$
  444.  
  445.       print local "\n\n   The next command controls the transmission of data.  Please use the"
  446.       print local "command that activates CTS flow control and does not activate XON/XOFF"
  447.       print local "flow control for transmitted data."
  448.       gosub cont
  449.  
  450.       cts_cmd$ = ""
  451.       getstring "Please enter the command for transmit flow control:", cts_cmd$
  452.  
  453.       print local "\n\n   The next command is for recieved data flow control via the RTS line."
  454.       print local "Please use the command that activates RTS flow control and disables "
  455.       print local "XON/XOFF flow control for received data."
  456.       gosub cont
  457.  
  458.       rts_cmd$ = ""
  459.       getstring "Please enter the command for receive flow control", rts_cmd$
  460.  
  461.       print local "\n\n   If your modem has a seperate command for software flow control, also"
  462.       print local "called \"XON/XOFF\" handshaking, please enter the command that disables"
  463.       print local "it as Terminus needs complete data transparency for file transfers to"
  464.       print local "work correctly."
  465.       gosub cont
  466.  
  467.       xoff_cmd$ = ""
  468.       getstring "Please enter the command to disable \"XON/XOFF\" flow control:", xoff_cmd$
  469.  
  470.       print local "\n   Since error correcting modems have an internal buffer they often can"
  471.       print local "clear the buffer when a break signal is sent.  If your modem has such a"
  472.       print local "command, please enter the one that will clear the buffer and also send"
  473.       print local "the break signal to the remote system."
  474.       gosub cont
  475.  
  476.       break_cmd$ = ""
  477.       getstring "Please enter the command to clear buffer and send a break", break_cmd$
  478.  
  479.       print local "\n   If there are any remaining commands that need to be sent to the"
  480.       print local "modem, please enter them now."
  481.       gosub cont
  482.  
  483.       extra_cmd$ = ""
  484.       getstring "Please enter miscellaneous commands", extra_cmd$
  485.  
  486.       if nvram$ == "Y"
  487.          print local "\nConfiguring advanced modem settings.\n"
  488.          modem_cmd$ = at_cmd$ + fixed_cmd$ + dsr_cmd$ + cts_cmd$ + rts_cmd$ + xoff_cmd$ + break_cmd$ + extra_cmd$ + save_cmd$ + modempostfix$
  489.          gosub send_cmd
  490.       else
  491.          print local "   Please reenter your modem commands, an error correcting modem should"
  492.          print local "have an NVRAM command to save the settings for future use."
  493.          gosub cont
  494.          goto set_modem
  495.       endif
  496.    endif
  497.  
  498.    sdefaults
  499.    cls
  500.    print local "\n\n\n   Your modem should now be configured for use with Terminus.  The"
  501.    print local "current Terminus settings have been saved to your defaults file.\n\n"
  502.    end
  503.